package com.huawei.admins.platform.gateway.core.component.filter;

import org.springframework.core.DecoratingProxy;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;

public class GatewayFilterAdapter implements GatewayFilter, DecoratingProxy {

    private final GlobalFilter delegate;

    public GatewayFilterAdapter(GlobalFilter delegate) {
        this.delegate = delegate;
    }

    @Override
    public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
        return this.delegate.filter(exchange, chain);
    }

    @Override
    public String toString() {
        return "GatewayFilterAdapter{" + "delegate=" + delegate + '}';
    }

    @Override
    public Class<?> getDecoratedClass() {
        return delegate.getClass();
    }

}